home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: Can a function return a array of pointers? a.s.a.p.
- Date: 20 Apr 1996 18:16:36 -0700
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4lc29kINNdkd@keats.ugrad.cs.ubc.ca>
- References: <4lalvn$536@badger.wmin.ac.uk>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <4lalvn$536@badger.wmin.ac.uk>,
- Idoia Lertxundi <gsoec@wmin.ac.uk> wrote:
- >My question is Can a function return a array of pointers?
- >
- >It seems that the compiler does not like the following:
- >
- >static char[] *ReadCodes(FILE *fptr, char *codes_array_p[MAX_CODES], char
- >*codes[MAX_CODES])
-
- In addition to Dan Pop's comment (arrays can't be passed or returned), the
- above is not the proper syntax for declaring an (impossible) function that is
- to return an array. Cast-style type expressions are not suitable for
- declarations. It's easy to make the mistake, though:
-
- static char readcodes(int arg)[3]
-
- {
- /* bogus function definition for returning
- an array of 3 char */
- }
-
-
- >even [MAX_CODES] gives an error, therefore how can I represent a function
- >returning a type array of pointers?
-
- As above. And no compiler for the C language will take it.
-